﻿Ext.Loader.setPath('Happy', '../../src');

Ext.onReady(function () {
    Ext.create('Ext.container.Viewport', {
        layout: 'fit',
        items: {
            xtype: 'form',
            title: '复选框分组演示',
            items: [{
                xtype: 'checkboxgroup',
                fieldLabel: 'CheckboxGroup',
                items: [
                    { boxLabel: 'Item 1', name: 'rb', inputValue: '1' },
                    { boxLabel: 'Item 2', name: 'rb', inputValue: '2', checked: true },
                    { boxLabel: 'Item 3', name: 'rb', inputValue: '3' },
                    { boxLabel: 'Item 4', name: 'rb', inputValue: '4' },
                    { boxLabel: 'Item 5', name: 'rb', inputValue: '5' },
                    { boxLabel: 'Item 6', name: 'rb', inputValue: '6' },
                    { boxLabel: 'Item 7', name: 'rb', inputValue: '7' },
                    { boxLabel: 'Item 8', name: 'rb', inputValue: '8' },
                    { boxLabel: 'Item 9', name: 'rb', inputValue: '9' },
                    { boxLabel: 'Item 10', name: 'rb', inputValue: '10' }
                ]
            }],
            tbar: [
                {
                    text: '取值', handler: function () {
                        Ext.Msg.show({
                            title: '消息',
                            msg: Ext.encode(this.up('form').down('happy-checkboxgroup').getValue())
                        });
                    }
                },
                {
                    text: '赋值', handler: function () {
                        this.up('form').down('happy-checkboxgroup').setValue({ rb: ['1', '2'] });
                    }
                },
                {
                    text: '表单取值', handler: function () {
                        Ext.Msg.show({
                            title: '消息',
                            msg: Ext.encode(this.up('form').getValues())
                        });
                    }
                }
            ]
        }
    });
});